Skip to content

Conversation

@fkiraly
Copy link
Collaborator

@fkiraly fkiraly commented May 29, 2025

Fixes #1764.

The reason is that numpy 2 added additional arguments to __array_wrap__ which was interacting with torch.Tensor.__array_wrap__ or pandas.Series.__array_wrap__ that did not have said arguments on earlier versions, in TorchNormalizer.

The warning can be avoided by explicit coercion to torch prior to mixed usage - avoiding mixed types across packages entirely.

This also makes the coercions more explicit, enabling future refactors where we may want to move to more "clean" type assumptions instead of polymorphic union types.

@fkiraly fkiraly requested a review from benHeid as a code owner May 29, 2025 09:00
@fkiraly fkiraly added the enhancement New feature or request label May 29, 2025
@fkiraly fkiraly changed the title [ENH] adderss __array_wrap__ change incompatibility between numpy 2 and early torch versions [ENH] adderss __array_wrap__ change incompatibility between numpy 2 and early torch or pandas versions May 29, 2025
@fkiraly fkiraly changed the title [ENH] adderss __array_wrap__ change incompatibility between numpy 2 and early torch or pandas versions [ENH] address __array_wrap__ change incompatibility between numpy 2 and early torch or pandas versions May 29, 2025
@fkiraly fkiraly marked this pull request as draft May 29, 2025 10:24
@fkiraly
Copy link
Collaborator Author

fkiraly commented Jul 3, 2025

Superseded by #1911

@fkiraly fkiraly closed this Jul 3, 2025
fkiraly pushed a commit that referenced this pull request Jul 9, 2025
…`pandas` (#1911)

fixes #1764

Adding the comments from the Initial PR
#1855 by @fkiraly


The reason is that `numpy 2` added additional arguments to
`__array_wrap__` which was interacting with
`torch.Tensor.__array_wrap__` or `pandas.Series.__array_wrap__` that did
not have said arguments on earlier versions, in `TorchNormalizer`.

The warning can be avoided by explicit coercion to `torch` prior to
mixed usage - avoiding mixed types across packages entirely.

This also makes the coercions more explicit, enabling future refactors
where we may want to move to more "clean" type assumptions instead of
polymorphic union types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] address numpy 2 deprecations

1 participant